﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../../fly.js" type="text/javascript"></script>
</head>
<body>
    <script id="temp" type="text/template">
        test template
        {@js}
            if(o.length>5){
                out(o.length)
            }
            else 
                out("not")
            return "____________________"
        {js@}

        {@for o as item,i}
            
            <div>ul:{i}</div>
            {@if item.show}
                <ul>
                    {@for item.nodes as node}
                        <li>{node.text}</li>
                    {for@}
                </ul>
            {@elseif item.show==false}
                <div>item.show==false</div>
            {@else}
                <div>item.show==undefined</div>
            {if@}
        {for@}
        Template simple demo ;
    </script>
    <script type="text/javascript">
        var temp = document.getElementById("temp");
        var tpl = temp.innerHTML || temp.textContent;
        var items = [{
            show: true,
            nodes: [{
                text: '1-1'
            }, {
                text: '1-2'
            }, {
                text: '1-3'
            }]
        }, {
            show: false,
            nodes: [{
                text: '2-1'
            }, {
                text: '2-2'
            }, {
                text: '2-3'
            }]
        }, {
            //show: true,
            nodes: [{
                text: '3-1'
            }, {
                text: '3-2'
            }, {
                text: '3-3'
            }]
        }]
        //debugger
        //        document.onclick = function () {
        var start = new Date();
        for (var i = 0; i < 1000; i++)
            var html = tpl.format(items);
        alert(new Date() - start);
        document.write(html);
        // }
        
    </script>
</body>
</html>
